package com.xmy.cultivate.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xmy.cultivate.enums.SourseLeveEnum;
import lombok.Data;
import org.crazycake.shiro.AuthCachePrincipal;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 登录账号
 * </p>
 *
 * @author min
 * @since 2022-07-28
 */
@Data
/**
 * AuthCachePrincipal:
 *  redis和shiro插件包提供的接口
 */
public class Admin implements Serializable, AuthCachePrincipal {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;

    private Long companyId;

    /**
     * 账号
     */
    private String account;

    /**
     * 密码
     */
    private String pwd;

    private String pwdShow;

    /**
     * 姓名
     */
    private String name;

    /*
     * 1全部校区，2指定校区,3所属校区
     */
    private Integer governMode;

    private Integer isLogin;

    /**
     * 性别
     */
    private Integer sex;

    private Integer deleted;

    private Integer isSuper;

    @TableField(exist = false)
    private Integer seeGuide;//是否查看引导:0未显示；1已显示

    @TableField(exist = false)
    private Integer seeVersion;//是否查看版本公告:0未显示；1已显示


    /**
     * created_at
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    /**
     * updated_at
     */
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    /**
     * deleted_at
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deletedAt;

    @Override
    public String getAuthCacheKey() {
        return null;
    }

    /**
     * 查看内容资源等级
     */
    @TableField(exist = false)
    private SourseLeveEnum sourseLeve;

    @TableField(exist = false)
    private List<Long> schoolIdList;

    @TableField(exist = false)
    private List<Long> roleIdList;

    @TableField(exist = false)
    private List<String> permissionCodeList;

    @TableField(exist = false)
    private List<Organization> organizationList;

    @TableField(exist = false)
    private List<Role> roleList;

    @TableField(exist = false)
    private Staff staffInfo;

    @TableField(exist = false)
    private Quarter quarterInfo;
}
